import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/Login/Login.vue'
import Main from '@/views/Main/Main.vue'
import Home from '@/views/Main/Home'
import User from '@/views/Main/User'
Vue.use(VueRouter)

const routes = [
  // 带有name属性的路由规则.叫做'命名路由 '
  {
    path: '/login',
    component: Login,
    name: 'login'
  },
  {
    // 如果子路由有默认的,那么注释调父页面里的name
    path: '/',
    component: Main,
    // name: 'main',
    children: [
      {
        path: '',
        component: Home,
        name: 'home'
      },
      {
        path: 'user',
        component: User,
        name: 'user'
      }
    ]
  }
]
const router = new VueRouter({
  routes
})

export default router
